home *** CD-ROM | disk | FTP | other *** search
/ Ubisoft Digital Press Ki….S.A./North America (USA) / Ubisoft Digital Press Kit 99 U.S.A.-North America (USA).bin / Dcr / language2.cst / 00038_Script_Scroll indicator contact < prev    next >
Text File  |  1999-05-03  |  4KB  |  113 lines

  1.  
  2.  
  3. -- Scroll Indicator Behavior
  4.  
  5. ---------------------------------------------------------------
  6. -- This behavior allows the scroll indicator to both indicate
  7. -- the amount the text has scrolled and to scroll the text 
  8. -- when the user drags the indicator. The behavior positions
  9. -- the indicator when it receives a positionIndicator message
  10. -- from the text behavior.
  11. --
  12. -- You attach this behavior to a scroll indicator.
  13. --
  14. -- 10/1/97 David Benman
  15. ---------------------------------------------------------------
  16.  
  17.  
  18. -- pIndicatorLowerLimit - the screen position the indicator
  19. -- can't move below.
  20. -- pIndicatorRange - the total range on the screen the
  21. -- indicator can travel.
  22. -- pClickedStatus - a boolean indicating if the 
  23. -- behavior's button has been clicked.
  24. -- pCurrentSprite - the behavior's sprite.
  25. property  pIndicatorLowerLimit, pIndicatorRange, pClickedStatusc, pCurrentSprite
  26.  
  27.  
  28. -- This handler sets the limits for the indicator's movement on
  29. -- the screen
  30. on beginSprite me
  31.   
  32.   -- Sets the lower limit for the indicators movement.
  33.   set pCurrentSprite to the spriteNum of me
  34.   set spacing to 3
  35.   set offset to ¼
  36.        the height of sprite pCurrentSprite/ 2 + spacing
  37.   set trackSprite to pCurrentSprite - 1
  38.   set trackSpriteTop to the top of sprite trackSprite
  39.   set pIndicatorLowerLimit to trackSpriteTop + offset
  40.   
  41.   -- Sets the upper limit and range for the indicator's
  42.   -- movement.
  43.   set trackSpriteBottom to the bottom of sprite trackSprite
  44.   set indicatorUpperLimitc to trackSpriteBottom - offset
  45.   set pIndicatorRange to ¼
  46.         indicatorUpperLimitc - pIndicatorLowerLimit
  47.   
  48.   -- Positions the indicator at its starting position.
  49.   set the locV of sprite pCurrentSprite to pIndicatorLowerLimit
  50.   
  51. end
  52.  
  53.  
  54. -- This handler positions the indicator on the screen to
  55. -- match the text's current position. Called by the text
  56. -- behavior when the behavior scrolls the text.
  57. on positionIndicatorc me, textRatio
  58.   
  59.   --Positions the indicator.
  60.   set currentPosition to pIndicatorRange * textRatio
  61.   set indicatorPosition to ¼
  62.             currentPosition + pIndicatorLowerLimit
  63.   set the locV of sprite pCurrentSprite to indicatorPosition
  64.   
  65. end
  66.  
  67.  
  68. -- This handler allows the Lingo clickOn function to
  69. -- be used for this sprite.
  70. on mouseDown me
  71.   -- Need mousedown script for the clickOn to register.
  72. end
  73.  
  74. -- This handler scrolls the indicator when you drag the
  75. -- indicator.
  76. on exitFrame me
  77.   if the mouseDown AND the clickOn = pCurrentSprite then
  78.     scrollTextcWithIndicator(me, the mouseV)
  79.   end if
  80. end
  81.  
  82. -- This handler determines the amount the text should scroll
  83. -- and sends a message to the text behavior to scroll the 
  84. -- text.
  85. on scrollTextcWithIndicator me, mouseVertical
  86.   set nextPosition to mouseVertical
  87.   
  88.   -- Limits indicator movement between the upper and lower
  89.   -- limits.
  90.   if nextPosition < pIndicatorLowerLimit then
  91.     set nextPosition to pIndicatorLowerLimit
  92.   else
  93.     set upperLimit to pIndicatorLowerLimit + pIndicatorRange
  94.     if nextPosition > upperLimit then
  95.       set nextPosition to upperLimit
  96.     end if
  97.   end if
  98.   
  99.   set ratioPosition to float(nextPosition-pIndicatorLowerLimit)
  100.   set ratio to ratioPosition/pIndicatorRange
  101.   
  102.   --Tells the text behavior to scroll the text.
  103.   sendAllSprites(#scrollTextc, ratio)
  104. end
  105.  
  106.  
  107. -- This handler tells other sprites like the track behavior 
  108. -- indicator's current screen position.
  109. on getIndicatorPosition me
  110.   return(the locV of sprite(pCurrentSprite))  
  111. end
  112.  
  113.